<?php
include '../config/auth.php';
$username=$_SESSION['user'];
$db = new PDO('mysql:host=120.77.37.81;dbname=onlinechat','root','123456');
$statement=$db->prepare('select * from user where username=:username');
$statement->execute([':username'=>$username]);
$user=$statement->fetch();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>星星聊天系统</title>
    <link type="text/css" href="../css/Update.css" rel="stylesheet">
</head>
<body>
<div id="all">
    <div class="top">
        <div class="left">
            <?php
            include '../config/welcome.php';
            ?>
        </div>
       <div class="right">
          <a href="MakeRoom.php">新建聊天室</a>&nbsp;&nbsp;&nbsp;
          <a href="Update.php">修改资料</a>&nbsp;&nbsp;&nbsp;
          <a href="Index.php">退出</a>&nbsp;&nbsp;&nbsp;
       </div>
   </div>
<div class="center">
    <div class="middle">
        <div class="ball">
            <form id="myForm" action="../action/UpdateAction.php" method="post" enctype="multipart/form-data">
                <div class="tip">
                    <div class="left2">
                        <div class="left3"> <label>用&nbsp;户&nbsp;名:&nbsp;&nbsp;</label></div>
                        <div class="right3"><?=$username; ?></div>
                    </div>
                </div>
                <div class="tip">
                    <div class="left2">
                       <div class="left3"><label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</label></div>
                       <div class="right3"><input type="password" name="password" value="<?=$user['password']; ?>" style="height: 30px;width: 200px"></div>
                    </div>
                    <div class="right2"><label id="message"></label></div>
                </div>
                <div class="tip">
                    <div class="left2">
                        <div class="left3"><label>确认密码:</label></div>
                        <div class="right3"><input type="password" name="confirm" value="<?=$user['password']; ?>"  style="height: 30px;width: 200px"></div>
                    </div>
                </div>
                <div class="tip">
                    <div class="left2">
                        <div class="left3"><label>昵&nbsp;&nbsp;&nbsp;称:&nbsp;&nbsp;&nbsp;&nbsp;</label></div>
                        <div class="right3"><input type="text" name="nickname" value="<?=$user['nickname']; ?>" style="height: 30px;width: 200px"></div>
                    </div>
                </div>
                <div class="tip">
                    <div class="left2">
                        <div class="left3"><label>用户图片:</label></div>
                        <div class="right3"><input id="file" type="file" name="image"></div>
                    </div>
                </div>
                <div class="tip">
                    <div class="left2">
                        <div class="left3"> <button type="button" style="height: 30px;width: 80px" onclick="window.location.href='Index.php';">返回</button></div>
                        <div class="right3"><button type="submit" id="submit" style="height: 30px;width: 80px">提交</button></div>
                    </div>
                </div>
            </form>
            <script src="../js/Update.js"></script>
        </div>
    </div>
</div>
</div>
</body>
</html>